Skip to content

Fix activity feed pagination error in getChallengeFeed#136

Open
prazgaitis wants to merge 2 commits into
mainfrom
claude/fix-activity-pagination-bRQDT
Open

Fix activity feed pagination error in getChallengeFeed#136
prazgaitis wants to merge 2 commits into
mainfrom
claude/fix-activity-pagination-bRQDT

Conversation

@prazgaitis

Copy link
Copy Markdown
Owner

Summary

Fixes Sentry error #7280439142 where getChallengeFeed throws "multiple paginated queries" error. The query was using .paginate() for the main feed while also calling .collect() within the hydration loop to count likes and comments. Convex only allows a single paginated query per function execution, and .collect() can internally trigger pagination for larger result sets.

Changes:

  • Replace .collect() with .take(500) for likes and comments counting in the activity hydration loop
  • Replace .collect() with .take(1000) for the follows query as a defensive measure
  • .take(n) avoids the internal pagination mechanism that .collect() can trigger

The limits chosen (1000 for follows, 500 for likes/comments) are generous for real-world usage and stay within Convex's per-function document read limits.

Testing

  • pnpm lint
  • pnpm typecheck

Notes

This is a targeted fix for the pagination constraint violation. The bounded .take() calls replace unbounded .collect() calls that were causing the error, while maintaining sufficient capacity for typical activity feed usage patterns.

https://claude.ai/code/session_01Q598Pr5xHFqAS7PAU1GCNA

@vercel

vercel Bot commented Mar 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
march-fitness-2025 Ready Ready Preview, Comment Mar 2, 2026 3:23am

Request Review

Replace .collect() calls with bounded .take() reads inside the paginated
getChallengeFeed query. Convex only allows a single paginated query per
function execution; .collect() on larger result sets can internally trigger
paginated reads, conflicting with the explicit .paginate() call on the
activities table.

Changes:
- follows query: .collect() → .take(1000)
- likes count per activity: .collect() → .take(500)
- comments count per activity: .collect() → .take(500)

Fixes Sentry #7280439142

https://claude.ai/code/session_01Q598Pr5xHFqAS7PAU1GCNA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants